package com.ccx.library.exception;

import com.ccx.library.response.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalException {

    @ExceptionHandler({NotTokenException.class})
    public R NotTokenException(){
        return R.NotToken();
    }

    @ExceptionHandler({LogErrorException.class})
    public R LogErrorException(){
        return R.FAIL("日志保存失败");
    }

    @ExceptionHandler({FreezeException.class})
    public R FreezeException(){
        return R.LOGIN_STATUS();
    }

    @ExceptionHandler({LoginException.class})
    public R LoginException(){
        return R.LOGIN_FAIL();
    }

    @ExceptionHandler({AccessDeniedException.class})
    public R AccessDeniedException(){
        return R.AccessDenied();
    }

    @ExceptionHandler({ExcelExportException.class})
    public R ExcelExportException(){
        return R.FAIL("Excel导出失败");
    }

    @ExceptionHandler({ExcelReadException.class})
    public R ExcelReadException(){
        return R.FAIL("Excel读取失败");
    }
}
